#ifndef CONTAINERCONTROL_H_
#define CONTAINERCONTROL_H_

#include <coecntrl.h>
#include <eiklabel.h>
#include <AknsBasicBackgroundControlContext.h>
#include <aknsdrawutils.h>
#include <aknscontrolcontext.h>
#include <AknsSkinInstance.h>
#include <aknsutils.h>
#include <eiksbfrm.h>
#include <flogger.h>
#include "Image.h"

class CContainerControl : public CCoeControl
{
public:
	static CContainerControl* NewL(const TRect& aRect, const CCoeControl* aParent);
	static CContainerControl* NewLC(const TRect& aRect, const CCoeControl* aParent);
	virtual ~CContainerControl();
private:
	CContainerControl();
	void ConstructL(const TRect& aRect, const CCoeControl* aParent);
public:
	// from base class CCoeControl
	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
	void HandlePointerEventL(const TPointerEvent& aPointerEvent);
	
public: // own methods
    // NOTE: Transfer ownership to CContainerControl
    void AddControlL(CCoeControl* aControl);
    void UpdateControls(TInt aOffset = 0, TBool aChangeCurPos = ETrue);
    void setEnableSkin(TBool aEnable);
    void SetBackGroundBitmap(CImage* aImage);
    
protected:
	TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
private: // from CCoeControl
    void Draw(const TRect& aRect) const;
    virtual void SizeChanged();
    virtual void HandleResourceChange(TInt aType);
private:
    void MoveFocusUpL();
    void MoveFocusDownL();
    void UpdateScrollBarFrameL();
    TBool IsInRect(CCoeControl* aCtrl);
private:
    CAknsBasicBackgroundControlContext*	iBgContext;
    CEikScrollBarFrame*                 iScrollBarFrame;
    TAknDoubleSpanScrollBarModel        iHDsSbarModel;
    TAknDoubleSpanScrollBarModel        iVDsSbarModel;
    TInt                                iFocusedIndex;
    TInt 								iCurPos;
    CCoeControl* 						iFocusControl;
    TBool								iShowScrollBar;
    TInt 								iMaxControlIndex;
    TBool                               iEnableSkin;
    CImage*                             iBackGroundBitmap;
	CCoeControl* iFirstControl;
	TInt iFirstPositionY;
    TInt iTotalHeight;
    RFileLogger iLog;
};

#endif /*CONTAINERCONTROL_H_*/
